#include <cstdio>

int main() {
    const int MAX = 100;
    int N, M;
    int num[MAX+10];
    scanf("%d%d", &N, &M);

    for (int i = 0; i < N; i++) {
        scanf("%d", &num[i]);
    }

    for (int i = 0; i < N; i++) {
        printf("%d%c", num[(N-(M%N)+i)%N], i==N-1?'\n':' ');
    }

    return 0;
}